#ifndef __NUMBER_EDIT_H__
#define __NUMBER_EDIT_H__

	#ifdef NUMBER_EDIT_MAIN
	 	#define NUMBER_EDIT_EXT
	#else
		#define NUMBER_EDIT_EXT extern
	#endif

#include "..\sys\sys_base0\utility.h"

//变量类型枚举
enum{
	VAL_TYPE_BIT,
	VAL_TYPE_S8,
	VAL_TYPE_U8,
	VAL_TYPE_S16,
	VAL_TYPE_U16,
	VAL_TYPE_S32,
	VAL_TYPE_U32,
	VAL_TYPE_FLOAT,
};

typedef struct{
	unsigned char val_type;	//变量类型
	unsigned char dec_nb;
	unsigned char save_mode;	//=0,按OK保存=1：即时保存
	void *adr;
	long min;
	long max;
}VAL_PROPERTY_T;

#define NUMBER_EDIT_FLASH_DIS_MS 250

typedef struct
{
	long val;	//编辑变量
	VAL_PROPERTY_T v;
	time_ms_T tm_flash;			//编辑位闪烁定时器
	unsigned char b_edit;		//正在编辑
	unsigned char b_flash;		//闪烁，=1熄灭
	unsigned char max_bit;		//变量最多有几位
	unsigned char cur_bit;		//当前位，0=最低位
}NUMBER_EDIT_T;

	
	
unsigned char Number_Edit(NUMBER_EDIT_T *p,unsigned char key_code);
void Number_Edit_Init(NUMBER_EDIT_T *p,VAL_PROPERTY_T *v);

NUMBER_EDIT_EXT NUMBER_EDIT_T g_number_edit;
	
#endif
